package com.packagetracker.custom;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;
import android.graphics.Paint.Style;
import android.util.AttributeSet;
import android.widget.LinearLayout;

public class TransparentPanel extends LinearLayout {
	
	private Paint inner;
	private Paint border;
	
	public TransparentPanel(final Context context) {
		super(context);
		this.init();
	}
	
	public TransparentPanel(final Context context, final AttributeSet attributes) {
		super(context, attributes);
		this.init();
	}
	
	private void init() {
		this.inner = new Paint();
		this.inner.setARGB(225, 75, 75, 75);
		this.inner.setAntiAlias(true);
		
		this.border = new Paint();
		this.border.setARGB(255, 255, 255, 255);
		this.border.setAntiAlias(true);
		this.border.setStyle(Style.STROKE);
		this.border.setStrokeWidth(2);
	}
	
	@Override
	protected void dispatchDraw(final Canvas canvas) {
		final RectF rectangle = new RectF();
		rectangle.set(0, 0, this.getMeasuredWidth(), this.getMeasuredHeight());
		
		canvas.drawRoundRect(rectangle, 5, 5, this.inner);
		canvas.drawRoundRect(rectangle, 5, 5, this.border);
		
		super.dispatchDraw(canvas);
	}
	
	public void setInner(final Paint inner) {
		this.inner = inner;
	}
	
	public void setBorder(final Paint border) {
		this.border = border;
	}
	
}